
pkgname=flex
pkgver=2.6.4
pkgrel=1
pkgdesc="A tool for generating text-scanning programs"
arch=('x86_64')
url="https://github.com/westes/flex"
license=('custom')
groups=('base-devel')
depends=('glibc' 'm4' 'sh')
makedepends=('help2man')
source=("https://github.com/westes/flex/releases/download/v${pkgver}/flex-${pkgver}.tar.gz")
md5sums=('2882e3179748cc9f9c23ec593d6adc8d')

prepare() {
  cd ${pkgname}-${pkgver}
  # build issues with 2.6.3 https://github.com/westes/flex/issues/162
  #patch -p1 -i ${srcdir}/f5d87f1a26f4a5c3402497008ae10e9a1345d327.diff
}

build() {
  cd ${pkgname}-${pkgver} 
  
  ./configure --prefix=/usr 
  make
}

check() {
  cd ${pkgname}-${pkgver}

  make check
}

package() {
  cd ${pkgname}-${pkgver} 
  make DESTDIR=${pkgdir} install
  
  ln -s flex ${pkgdir}/usr/bin/lex 
  install -Dm644 COPYING ${pkgdir}/usr/share/licenses/${pkgname}/license.txt 
}
